<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />

		<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
		Remove this if you use the .htaccess -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

		<title>javascript01</title>
		<meta name="description" content="" />
		<meta name="author" content="choongang" />

		<meta name="viewport" content="width=device-width; initial-scale=1.0" />

		<!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
		<link rel="shortcut icon" href="/favicon.ico" />
		<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
	</head>

	<body>
		<script>
			//타입이 없다!! var는 전역변수 선언(맴버변수) , 안쓰면 지역 변수 {여기서만 유효}
			
			var a = 10;
			var b = "hello";
			var c = "true";
			d=0;
			e="bye";
			
			person=new Object();
			person.name="홍길동";
			person.age="28";
			person.city="서울";
			console.log("이름은 : ",person);
			console.log("B는 : ",b);
			
			lion={name:"사자",age:5,city:"아프리카"}
			console.log("lion : ",lion);
			function hello(){
				//objectName.propertyName
				d= b.length;
				a++;
				//objectName.methodName()
				alert("안녕! ! ! ! "+a+"  hello 의 길이는 "+d);
			}
			function Taxi(money,location){
				this.money=money; //속성
				this.locatcion=location;
				this.changeMoney=changeMoney;
				
				function changeMoney(newMoney){ //매서드
					this.money=newMoney;
				}
			}
			
			taxi1=new Taxi(3000,"강북");
			console.log("강북까지 택시 요금은? " , taxi1)
			taxi1.changeMoney(5000);
			console.log("강북까지 바뀐 택시요금은? " , taxi1)
			
			for(x in taxi1){
				console.log("taxi[x] ? ",taxi[x]);
			}
			for(x in lion){
				console.log("lion[x] ? " , lion[x]);
			}
			
			
		</script>
		<button onclick="hello()">눌러보세요 ! ! ! </button>
		<script>
			buttons=document.getElementsByTagName("button");			
			button=buttons[0];
			for(x in button){
				console.log("button 에는 무엇이? ", button[x]);
			}
			date1=new  Date();
			date2=new Date(2013,0,9);
			document.write("<br>"+date1+"<br>");
			document.write(date2+"<br>");
			
			web= new Array();
			document.write("web 는 "+web+"<br>");
			console.log("web 는 ",web);
			web[0]="html5"
			web[1]="java scripct"
			web[2]="css3"
			document.write("web 는 "+web+"<br>");
			console.log("web 는 ",web);
			
			day=["아침","점심","저녁"];
			console.log("day : " , day);
			console.log("button=" , button);
			
		</script>
		<br>
		<div id="c">
			클릭해 보세요!!		
		</div>
		<br>
		<div id="on">
			마우스를 올려보세요
		</div>
		<br>
		<div id="off">
			여기에서 마우스버튼을 띄어보세요
		</div>
		<br>
		<div id="canvas">
			그림판
		</div>
		<br>
		
		<script>
			c = document.getElementById("c");
			on = document.getElementById("on");
			off = document.getElementById("off");
			canvas = document.getElementById("canvas");
			console.log("이전 C" ,c);
			c.onclick=function(){
				canvas.innerHTML="c 클릭햇군요";
			}
			on.onmouseover=function(){
				canvas.innerHTML ="on에 마우스를 올렸군요";
			}
			off.onmouseup=function(){
				canvas.innerHTML ="off에 마우스 버튼을 눌렀다 놨군요"	;			
			}
			console.log("이후 C" ,c);
		
		</script>
		
	</body>
</html>








